<template>
  <div class="lm_row">
    <div class="lm_avatar">
      <img v-if="message.avatar" class="avatar" :src="message.avatar" alt="头像"/>
      <div v-else class="avatar_txt">{{message.userName | userNameFlt}}</div>
    </div>
    <div class="lm_info">
      <div class="lm_tit">{{message.userName}}</div>
      <div class="lm_txt">{{message.allocateMessage}}</div>
      <div class="lm_tip">
        <span>{{message.createTime}}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    message: {
      type: Object,
      default: {}
    }
  },
  filters: {
    userNameFlt(val) {
      return val.slice(0, 1)
    }
  }
}
</script>

<style lang="scss" scoped>
.lm_row {
  width: 100%;
  border-bottom: solid 1px #f6f6f6;
  padding: 15px 0;
  .lm_avatar {
    float: left;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: solid 1px rgba(173, 173, 173, 0.1);
    .avatar {
      display: block;
      width: 100%;
      height: 100%;
    }
    .avatar_txt {
      width: 100%;
      height: 100%;
      text-align: center;
      font-size: 16px;
      line-height: 40px;
      background-color: #2489c5;
      color: #fff;
    }
  }
  .lm_info {
    margin-left: 50px;
    font-size: 14px;
    .lm_tit {
      color: #2489c5;
      margin-bottom: 8px;
    }
    .lm_txt {
      color: #333;
      line-height: 1.6em;
    }
    .lm_tip {
      color: #c4c4c4;
      text-align: right;
    }
  }
}
</style>
